/*
公共函数
 */

class C {

	/*
	 * 判断是否在数组中存在
	 * @author: huang
	 * 支持多个属性判断
	 */
	inarray (obj, array) {
		let key = -1
		array.forEach((row, index) => {
			let ishave = true
			for (let i in obj) {	
				if (row[i] != obj[i]) {
					ishave = false
				}
			}
			if (ishave) key = index
		})
		return key
		alert(333)
	}
	/*
	 * 删除一行
	 * @author: 黄
	 */
	deleterow (index, array) {
		array.splice(index, 1)
	}

	/*
	 * 关闭窗口
	 * @author: 黄
	 */
	closewin () {
		const electron = require('electron')
		const win = electron.remote.getCurrentWindow()
		win.close()
	}
}



/*Cmon.inarray = function (obj, array) {
	let key = -1
	array.forEach((row, index) => {
		let ishave = true
		for (let i in obj) {	
			if (row[i] != obj[i]) {
				ishave = false
			}
		}
		if (ishave) key = index
	})
	return key
}*/


module.exports = new C